﻿using IntelligentAgriculture.Contracts.Dto.Input;
using IntelligentAgriculture.Contracts.Dto.Output;
using IntelligentAgriculture.Contracts.Interface;
using IntelligentAgriculture.Domain.Entity;
using IntelligentAgriculture.WebAPI.Application.Command.StartCommand;
using MediatR;
using System.Collections.Generic;

namespace IntelligentAgriculture.WebAPI.Application.CommandHandler.StartCommandHandler
{

    /// <summary>
    /// 期初添加CommandHandler
    /// </summary>
    public class StartCreateCommandHandler : IRequestHandler<StartCreateCommand, Results<int>>
    {
        private readonly IStartService _service;
        public StartCreateCommandHandler(IStartService service)
        {
            _service = service;
        }
        public async Task<Results<int>> Handle(StartCreateCommand request, CancellationToken cancellationToken)
        {
           
            var list = await _service.AddStartAsync(request.starts);
            // 返回结果
            return Results<int>.DataResult(list);
        }


    }
}
